package org.example.Test;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Test2025 {
    public static void main(String[] args) {
        List<LocalDate> collect = Stream.iterate(LocalDate.now().withDayOfMonth(1), // 基准日期设为当月1号‌:ml-citation{ref="4" data="citationList"}
                        date -> date.minusMonths(1))             // 每次减1个月‌:ml-citation{ref="1" data="citationList"}
                .limit(18)                                      // 取前18个月‌:ml-citation{ref="1" data="citationList"}
                .collect(Collectors.toList());

        System.out.println(collect);



        LocalDate lastDay = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth());
        LocalDateTime endOfDay = lastDay.atTime(23, 59, 59);
        System.out.println("本月月末时间: " + lastDay);

        boolean isLastDay = LocalDate.now().plusDays(3).equals(
                LocalDate.now().with(TemporalAdjusters.lastDayOfMonth())
        );
        System.out.println("今天是月末吗？ " + isLastDay);
    }
}
